package com.weu.mapper;

import com.weu.bean.UserType;
import org.apache.ibatis.annotations.*;

import java.util.Collection;
import java.util.List;

@Mapper
public interface UserTypeMapper {

    /**
     * 根据角色ID查询用户角色
     *
     * @param id
     * @return
     */
    @Select("select * from ilmc_usertype where type_id=#{id}")
    public UserType getUserTypeById(int id);

    /**
     * 查询所有的用户角色
     *
     * @return
     */
    @Select("select * from ilmc_usertype")
    public List<UserType> getUserTypes();

    /**
     * 插入用户角色
     * @param userType
     * @return
     */
    @Options(useGeneratedKeys = true, keyProperty = "id")
    @Insert("insert into ilmc_usertype(type_name) values(#{typeName})")
    public int insertUserType(UserType userType);


    /**
     * 修改角色
     * @param userType
     * @return
     */
    @Update("update ilmc_usertype set type_name=#{typeName} where type_id=#{typeId}")
    public int updateUserType(UserType userType);


    /**
     * 根据角色ID删除指定角色
     * @param id
     * @return
     */
    @Delete("delete from ilmc_usertype where type_id=#{id}")
    public int deleteUserTypeById(int id);
}